
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>API - Vue Carousel</title>
        <meta charset="utf-8">
        <meta name="description" content="Vue Carousel - A flexible, responsive, touch-friendly carousel for Vue.js">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">

        <meta property="og:type" content="article">
        <meta property="og:title" content="API - Vue Carousel">
        <meta property="og:description" content="Vue Carousel - A flexible, responsive, touch-friendly carousel for Vue.js">
        <meta property="og:image" content="https:///images/logo.png">

        <meta name="twitter:card" content="summary">
        <meta name="twitter:title" content="API - Vue Carousel">
        <meta name="twitter:description" content="Vue Carousel - A flexible, responsive, touch-friendly carousel for Vue.js">
        <meta name="twitter:image" content="https:///images/logo.png">

        <link rel="icon" href="/vue-carousel/images/logo.png" type="image/x-icon">

        <link href='//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600|Roboto Mono' rel='stylesheet' type='text/css'>
        <link href='//fonts.googleapis.com/css?family=Dosis:500&text=Vue.js' rel='stylesheet' type='text/css'>

        <!-- main page styles -->
        <link rel="stylesheet" href="/vue-carousel/css/page.css">

        <!-- this needs to be loaded before guide's inline scripts -->
        <script src="/vue-carousel/js/vue.js"></script>
        <script src="/vue-carousel/js/vue-carousel.min.js"></script>
        <script>window.PAGE_TYPE = ""</script>
    </head>
    <body class="docs">        <div id="mobile-bar" >
            <a class="menu-button"></a>
            <a class="logo" href="/vue-carousel/"></a>
        </div>
        <div id="header">
  <a id="logo" href="/vue-carousel/">
    <img src="/vue-carousel/images/logo.png" alt="Vue Carousel">
    <span>Vue Carousel</span>
  </a>
  <ul id="nav">
    <li><a href="/vue-carousel/guide" class="nav-link">Guide</a></li>
<li><a href="/vue-carousel/api" class="nav-link current">API</a></li>
<li><a href="/vue-carousel/examples" class="nav-link">Examples</a></li>

  </ul>
</div>

        
            <div id="main" class="fix-sidebar">
                
                    
  <div class="sidebar">
    <ul class="main-menu">
      <li><a href="/vue-carousel/guide" class="nav-link">Guide</a></li>
<li><a href="/vue-carousel/api" class="nav-link current">API</a></li>
<li><a href="/vue-carousel/examples" class="nav-link">Examples</a></li>

    </ul>
  </div>

<div class="content  ">
    
    
      <h1>API</h1>
    
    <h2 id="Global-config"><a href="#Global-config" class="headerlink" title="Global config"></a>Global config</h2><h3 id="adjustableHeight"><a href="#adjustableHeight" class="headerlink" title="adjustableHeight"></a>adjustableHeight</h3><p>Adjust the height of the carousel for the current slide.</p>
<ul>
<li><strong>Type</strong>: <code>Boolean</code></li>
<li><strong>Default</strong>: <code>false</code></li>
</ul>
<h3 id="adjustableHeightEasing"><a href="#adjustableHeightEasing" class="headerlink" title="adjustableHeightEasing"></a>adjustableHeightEasing</h3><p>Slide transition easing for adjustableHeight.</p>
<ul>
<li><strong>Type</strong>: <code>String</code></li>
</ul>
<h3 id="autoplay"><a href="#autoplay" class="headerlink" title="autoplay"></a>autoplay</h3><p>Flag to enable autoplay.</p>
<ul>
<li><strong>Type</strong>: <code>Boolean</code></li>
<li><strong>Default</strong>: <code>false</code></li>
</ul>
<h3 id="autoplayDirection"><a href="#autoplayDirection" class="headerlink" title="autoplayDirection"></a>autoplayDirection</h3><p>Sets the autoplay direction for the carousel during autoplay.</p>
<ul>
<li><strong>Type</strong>: <code>String</code></li>
<li><strong>Default</strong>: <code>forward</code></li>
</ul>
<h3 id="autoplayTimeout"><a href="#autoplayTimeout" class="headerlink" title="autoplayTimeout"></a>autoplayTimeout</h3><p>Time elapsed before advancing slide in autoplay.</p>
<ul>
<li><strong>Type</strong>: <code>Number</code></li>
<li><strong>Default</strong>: <code>2000</code></li>
</ul>
<h3 id="autoplayHoverPause"><a href="#autoplayHoverPause" class="headerlink" title="autoplayHoverPause"></a>autoplayHoverPause</h3><p>Flag to pause autoplay on hover.</p>
<ul>
<li><strong>Type</strong>: <code>Boolean</code></li>
<li><strong>Default</strong>: <code>true</code></li>
</ul>
<h3 id="centerMode"><a href="#centerMode" class="headerlink" title="centerMode"></a>centerMode</h3><p>Center images when the size is less than the container width</p>
<ul>
<li><strong>Type</strong>: <code>Boolean</code></li>
<li><strong>Default</strong>: <code>false</code></li>
</ul>
<h3 id="easing"><a href="#easing" class="headerlink" title="easing"></a>easing</h3><p>Transition speed between slides. Any valid CSS transition easing is accepted.</p>
<ul>
<li><strong>Type</strong>: <code>String</code></li>
<li><strong>Default</strong>: <code>ease</code></li>
</ul>
<h3 id="loop"><a href="#loop" class="headerlink" title="loop"></a>loop</h3><p>Flag to make the carousel loop (wrap) when it reaches either end.</p>
<ul>
<li><strong>Type</strong>: <code>Boolean</code></li>
<li><strong>Default</strong>: <code>false</code></li>
</ul>
<h3 id="minSwipeDistance"><a href="#minSwipeDistance" class="headerlink" title="minSwipeDistance"></a>minSwipeDistance</h3><p>Minimum distance in pixels to swipe before a slide advance is triggered.</p>
<ul>
<li><strong>Type</strong>: <code>Number</code></li>
<li><strong>Default</strong>: <code>8</code></li>
</ul>
<h3 id="mouseDrag"><a href="#mouseDrag" class="headerlink" title="mouseDrag"></a>mouseDrag</h3><p>Flag to toggle mouse dragging.</p>
<ul>
<li><strong>Type</strong>: <code>Boolean</code></li>
<li><strong>Default</strong> <code>true</code></li>
</ul>
<h3 id="perPage"><a href="#perPage" class="headerlink" title="perPage"></a>perPage</h3><p>Maximum number of slides displayed on each page.</p>
<ul>
<li><strong>Type</strong>: <code>Number</code></li>
<li><strong>Default</strong>: <code>2</code></li>
</ul>
<h3 id="perPageCustom"><a href="#perPageCustom" class="headerlink" title="perPageCustom"></a>perPageCustom</h3><p>Configure the number of visible slides for responsive breakpoints.</p>
<p>This will be an array of arrays. Each array is formatted as [x, y] where x is the browser width, and y is the number of slides displayed.</p>
<ul>
<li><strong>Type</strong>: <code>Array</code></li>
<li><strong>Usage</strong>:</li>
</ul>
<figure class="highlight html"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line"><span class="tag">&lt;<span class="name">carousel</span> <span class="attr">:per-page-custom</span>=<span class="string">"[[768, 3], [1024, 4]]"</span>&gt;</span></div></pre></td></tr></table></figure>
<p>A mobile-first strategy is used to determine the matching breakpoint. In the above example, the <a href="/vue-carousel/api#perPage">perPage</a> variable has not been set, so the default of <strong>2</strong> is used. If the window size is greater than or equal to 768px, then 3 slides are shown. If the width is greater than or equal to 1024, then 4 slides are shown.</p>
<h3 id="resistanceCoef"><a href="#resistanceCoef" class="headerlink" title="resistanceCoef"></a>resistanceCoef</h3><p>Resistance coefficient to dragging on the edge of the carousel. This dictates the effect of the pull as you move towards the boundaries.</p>
<ul>
<li><strong>Type</strong>: <code>Number</code></li>
<li><strong>Default</strong>: <code>20</code></li>
</ul>
<h3 id="scrollPerPage"><a href="#scrollPerPage" class="headerlink" title="scrollPerPage"></a>scrollPerPage</h3><p>Scroll per page, not per item.</p>
<ul>
<li><strong>Type</strong>: <code>Boolean</code></li>
<li><strong>Default</strong>: <code>false</code></li>
</ul>
<h3 id="size"><a href="#size" class="headerlink" title="size"></a>size</h3><p>Size of each pagination dot. Pixel values are accepted.</p>
<ul>
<li><strong>Type</strong> <code>Number</code></li>
<li><strong>Default</strong>: <code>10</code></li>
</ul>
<h3 id="spacePadding"><a href="#spacePadding" class="headerlink" title="spacePadding"></a>spacePadding</h3><p>Stage padding option adds left and right padding style (in pixels) onto VueCarousel-inner.</p>
<ul>
<li><strong>Type</strong>: <code>Number</code></li>
<li><strong>Default</strong>: <code>0</code></li>
</ul>
<h3 id="spacePaddingMaxOffsetFactor"><a href="#spacePaddingMaxOffsetFactor" class="headerlink" title="spacePaddingMaxOffsetFactor"></a>spacePaddingMaxOffsetFactor</h3><p>Specify by how much should the space padding value be multiplied of, to re-arange the final slide padding.</p>
<ul>
<li><strong>Type</strong> <code>Number</code></li>
<li><strong>Default</strong>: <code>0</code></li>
</ul>
<h3 id="speed"><a href="#speed" class="headerlink" title="speed"></a>speed</h3><p>Slide transition speed. Number of milliseconds accepted.</p>
<ul>
<li><strong>Type</strong> <code>Number</code></li>
<li><strong>Default</strong>: <code>500</code></li>
</ul>
<h3 id="value"><a href="#value" class="headerlink" title="value"></a>value</h3><p>Support for v-model functionality.<br>Setting this value will change the current page to the number inputted (if between 0 and pageCount).</p>
<ul>
<li><strong>Type</strong> <code>Number</code></li>
</ul>
<h2 id="Navigation"><a href="#Navigation" class="headerlink" title="Navigation"></a>Navigation</h2><p>Configure the navigation component (next/prev buttons)</p>
<h3 id="navigationEnabled"><a href="#navigationEnabled" class="headerlink" title="navigationEnabled"></a>navigationEnabled</h3><p>Flag to render the navigation component (next/prev buttons).</p>
<ul>
<li><strong>Type</strong>: <code>Boolean</code></li>
<li><strong>Default</strong>: <code>false</code></li>
</ul>
<h3 id="navigateTo"><a href="#navigateTo" class="headerlink" title="navigateTo"></a>navigateTo</h3><p>Allow carousel parent to programatically navigate to a specific slide (zero based index). Recommend using parent data attribute pageNo and carousel pageChange event to keep pageNo in sync with carousel.currentPage to handle subsequent navigation.</p>
<ul>
<li><strong>Type</strong>: <code>Number</code></li>
<li><strong>Default</strong>: 0</li>
</ul>
<h3 id="navigationClickTargetSize"><a href="#navigationClickTargetSize" class="headerlink" title="navigationClickTargetSize"></a>navigationClickTargetSize</h3><p>Amount of padding to apply around the label in pixels.</p>
<ul>
<li><strong>Type</strong>: <code>Number</code></li>
<li><strong>Default</strong>: <code>8</code></li>
</ul>
<h3 id="navigationNextLabel"><a href="#navigationNextLabel" class="headerlink" title="navigationNextLabel"></a>navigationNextLabel</h3><p>Text content of the navigation next button.</p>
<ul>
<li><strong>Type</strong>: <code>String</code></li>
<li><strong>Default</strong>: <code>▶</code></li>
</ul>
<h3 id="navigationPrevLabel"><a href="#navigationPrevLabel" class="headerlink" title="navigationPrevLabel"></a>navigationPrevLabel</h3><p>Text content of the navigation prev button.</p>
<ul>
<li><strong>Type</strong>: <code>String</code></li>
<li><strong>Default</strong>: <code>◀</code></li>
</ul>
<h3 id="navigateTo-1"><a href="#navigateTo-1" class="headerlink" title="navigateTo"></a>navigateTo</h3><p>Allow carousel parent to programatically navigate to a specific slide (zero based index). Recommend using parent data attribute pageNo and carousel pageChange event to keep pageNo in sync with carousel.currentPage to handle subsequent navigation. To disable the sliding animation the following syntax is to be followed-  :navigateTo=[index, false] where index is the slide number (starts from zero) you want to navigate to.</p>
<ul>
<li><strong>Type</strong>: <code>Number</code> | <code>Array</code></li>
<li><strong>Default</strong>: 0</li>
</ul>
<h2 id="Pagination"><a href="#Pagination" class="headerlink" title="Pagination"></a>Pagination</h2><p>Configure the pagination component (clickable page dots)</p>
<h3 id="paginationEnabled"><a href="#paginationEnabled" class="headerlink" title="paginationEnabled"></a>paginationEnabled</h3><p>Flag to render pagination component.</p>
<ul>
<li><strong>Type</strong>: <code>Boolean</code></li>
<li><strong>Default</strong>: <code>true</code></li>
</ul>
<h3 id="paginationActiveColor"><a href="#paginationActiveColor" class="headerlink" title="paginationActiveColor"></a>paginationActiveColor</h3><p>The fill color of the active pagination dot. Any valid CSS color is accepted.</p>
<ul>
<li><strong>Type</strong>: <code>String</code></li>
<li><strong>Default</strong>: <code>#000000</code></li>
</ul>
<h3 id="paginationColor"><a href="#paginationColor" class="headerlink" title="paginationColor"></a>paginationColor</h3><p>The fill color of pagination dots. Any valid CSS color is accepted.</p>
<ul>
<li><strong>Type</strong>: <code>String</code></li>
<li><strong>Default</strong>: <code>#efefef</code></li>
</ul>
<h3 id="paginationPosition"><a href="#paginationPosition" class="headerlink" title="paginationPosition"></a>paginationPosition</h3><p>The position of pagination dots. Possible values are <code>bottom</code>, <code>bottom-overlay</code>, <code>top</code> and <code>top-overlay</code>. The overlay values place the pagination component over the images.</p>
<ul>
<li><strong>Type</strong>: <code>String</code></li>
<li><strong>Default</strong>: <code>bottom</code></li>
</ul>
<h3 id="paginationPadding"><a href="#paginationPadding" class="headerlink" title="paginationPadding"></a>paginationPadding</h3><p>The padding inside each pagination dot. Pixel values are accepted.</p>
<ul>
<li><strong>Type</strong>: <code>Number</code></li>
<li><strong>Default</strong>: <code>10</code></li>
</ul>
<h3 id="paginationSize"><a href="#paginationSize" class="headerlink" title="paginationSize"></a>paginationSize</h3><p>The size of each pagination dot. Pixel values are accepted.</p>
<ul>
<li><strong>Type</strong>: <code>Number</code></li>
<li><strong>Default</strong>: <code>10</code></li>
</ul>
<h3 id="spacePadding-1"><a href="#spacePadding-1" class="headerlink" title="spacePadding"></a>spacePadding</h3><p>Stage padding option adds left and right padding style (in pixels) onto VueCarousel-inner.</p>
<ul>
<li><strong>Type</strong>: <code>Number</code></li>
<li><strong>Default</strong>: <code>0</code></li>
</ul>
<h2 id="Custom-Pagination-amp-Navigation"><a href="#Custom-Pagination-amp-Navigation" class="headerlink" title="Custom Pagination &amp; Navigation"></a>Custom Pagination &amp; Navigation</h2><p>Use named slots to render pagination and navigation using components.</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div></pre></td><td class="code"><pre><div class="line"><span class="tag">&lt;<span class="name">carousel</span>&gt;</span></div><div class="line">  <span class="tag">&lt;<span class="name">slide</span>&gt;</span></div><div class="line">    Slide 1 Content</div><div class="line">  <span class="tag">&lt;/<span class="name">slide</span>&gt;</span></div><div class="line">  <span class="tag">&lt;<span class="name">slide</span>&gt;</span></div><div class="line">    Slide 2 Content</div><div class="line">  <span class="tag">&lt;/<span class="name">slide</span>&gt;</span></div><div class="line"></div><div class="line">  <span class="tag">&lt;<span class="name">numbered-pagination</span> <span class="attr">slot</span>=<span class="string">"pagination"</span> /&gt;</span></div><div class="line">  <span class="tag">&lt;<span class="name">stylish-navigation</span> <span class="attr">slot</span>=<span class="string">"navigation"</span> /&gt;</span></div><div class="line"><span class="tag">&lt;/<span class="name">carousel</span>&gt;</span></div></pre></td></tr></table></figure>
<p>Your components can access the <code>carousel</code> provider by adding the following to you component configuration:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">name: &quot;numbered-pagination&quot;,</div><div class="line">inject: [&quot;carousel&quot;]</div></pre></td></tr></table></figure>
<h2 id="Events"><a href="#Events" class="headerlink" title="Events"></a>Events</h2><p>Events emitted from components</p>
<h3 id="page-change"><a href="#page-change" class="headerlink" title="page-change"></a>page-change</h3><p><code>page-change</code> event emits the value of the current page.</p>
<ul>
<li><strong>Type</strong>: <code>Number</code></li>
<li><strong>Emitter</strong>: <code>Carousel</code></li>
</ul>
<h3 id="slide-click"><a href="#slide-click" class="headerlink" title="slide-click"></a>slide-click</h3><p><code>slide-click</code> event throws the <em>dataset</em> object of the selected element.</p>
<ul>
<li><strong>Type</strong>: <code>Object</code></li>
<li><strong>Emitter</strong>: <code>Slide</code></li>
</ul>
<h3 id="transition-start"><a href="#transition-start" class="headerlink" title="transition-start"></a>transition-start</h3><p><code>transition-start</code> event is thrown when the transition starts.</p>
<ul>
<li><strong>Type</strong>: <code>none</code></li>
<li><strong>Emitter</strong>: <code>Carousel</code></li>
</ul>
<h3 id="transition-end"><a href="#transition-end" class="headerlink" title="transition-end"></a>transition-end</h3><p><code>transition-end</code> event is thrown when the transition end is reached.</p>
<ul>
<li><strong>Type</strong>: <code>none</code></li>
<li><strong>Emitter</strong>: <code>Carousel</code></li>
</ul>
<blockquote>
<p>Lowercase versions of the above events are also emitted, namely—<code>pagechange</code>, <code>slideclick</code>, <code>transitionstart</code> and <code>transitionend</code>.</p>
</blockquote>

    
    <div class="footer">
      Caught a mistake or want to contribute to the documentation?
      <a href="https://github.com/SSENSE/vue-carousel/blob/master/docs/source/api/index.md" target="_blank">
        Edit this page on Github!
      </a>
    </div>
</div>

                
            </div>
            <script src="/vue-carousel/js/smooth-scroll.min.js"></script>
        

        <!-- main custom script for sidebars, version selects etc. -->
        <script src="/vue-carousel/js/common.js"></script>

        <!-- ga -->
        <script>
          (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
          (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
          m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
          })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

          ga('create', '', '');
          ga('send', 'pageview');
        </script>

        <!-- search -->
        <link href="//cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css" rel='stylesheet' type='text/css'>
        <link rel="stylesheet" href="/vue-carousel/css/search.css">
        <script src="//cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script>
        <script>
        [
          '#search-query-nav',
          '#search-query-sidebar'
        ].forEach(function (selector) {
          if (!document.querySelector(selector)) return
          // search index defaults to v2
          var match = window.location.pathname.match(/^\/(v\d+)/)
          var version = match ? match[1] : 'v2'
          docsearch({
            appId: 'BH4D9OD16A',
            apiKey: '85cc3221c9f23bfbaa4e3913dd7625ea',
            indexName: 'vuejs',
            inputSelector: selector,
            algoliaOptions: { facetFilters: ["version:" + version] }
          })
        })
        </script>

        <!-- fastclick -->
        <script src="//cdnjs.cloudflare.com/ajax/libs/fastclick/1.0.6/fastclick.min.js"></script>
        <script>
        document.addEventListener('DOMContentLoaded', function() {
          FastClick.attach(document.body)
        }, false)
        </script>
    </body>
</html>
